package cn.edu.scau.cmi.wujiaxian.exercise11;

import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class WindowDocument extends JFrame{
	private static final long serialVersionUID = 4174621914605686809L;

	JTextArea inputArea;
	JTextArea outputArea;
	PoliceListen3 listener;
	
	public WindowDocument() {
		init();
		setVisible(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	
	void init() {
		setLayout(new FlowLayout());
		inputArea = new JTextArea(6, 8);
		outputArea = new JTextArea(6, 8);
		add(new JScrollPane(inputArea));
		add(new JScrollPane(outputArea));
		listener = new PoliceListen3();
		listener.setInputArea(inputArea);
		listener.setOutputArea(outputArea);
		inputArea.getDocument().addDocumentListener(listener);
	}
	
}
